<?php
namespace Admin\Controller;
use Think\Controller;
class OrderController extends Controller 
{
    public function edit()
    {
    	if(IS_POST)
    	{
    		$model = D('Order');
    		if($model->create(I('post.'), 2))
    		{
    			if($model->save() !== FALSE)
    			{
    				$this->success('订单更新成功！', U('lst', array('p' => I('get.p', 1))));
    				exit;
    			}
    		}
    		$this->error($model->getError());
    	}
    	$orderId = I('get.order_id');
    	$OrderModel = D('Order');
    	$OrderData = $OrderModel->getDetail($orderId);
    	$this->assign('order', $OrderData);

		// 设置页面中的信息
		$this->assign(array(
			'_page_title' => '订单更新',
			'_page_btn_name' => '订单列表',
            '_module_name' => '订单模块',
			'_page_btn_link' => U('lst'),
		));
		$this->display();
    }
    public function delete()
    {
    	$model = D('Order');
    	if($model->delete(I('get.id', 0)) !== FALSE)
    	{
    		$this->success('取消订单成功！', U('Order/lst'));
    		exit;
    	}
    	else 
    	{
    		$this->error($model->getError());
    	}
    }
    public function lst()
    {
    	$model = D('Order');
    	$data = $model->lst();
    	$this->assign(array(
    		'data' => $data['data'],
    		'page' => $data['page'],
    	));

		// 设置页面中的信息
		$this->assign(array(
			'_page_title' => '订单列表',
			'_module_name' => '订单模块',
		));
    	$this->display();
    }


}